using System;
using System.ComponentModel;
using System.Linq;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ApiTest.Entitys
{
    /// <summary>
    /// 商品模板
    /// </summary>  
    /// <remarks>
    /// <![CDATA[ENGINE=InnoDB  COMMENT='商品模板']]>
    /// </remarks>
    [DbSource("Default"), Serializable]
    public class Goods
    {
        /// <summary>
        /// goods_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[bigint NOT NULL COMMENT '']]>
        /// </remarks>
        [Primary]
        public long GoodsId { get; set; }

        /// <summary>
        /// 供应商id
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '供应商id']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("供应商id")]
        public int SupplierId { get; set; }

        /// <summary>
        /// 品名
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(128) DEFAULT NULL COMMENT '品名']]>
        /// </remarks>
        [Column(128)]
        [DisplayName("品名")]
        public string GoodsName { get; set; }

        /// <summary>
        /// 类目
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(255) DEFAULT NULL COMMENT '类目']]>
        /// </remarks>
        [Column(255)]
        [DisplayName("类目")]
        public string ClassifyCode { get; set; }

        /// <summary>
        /// brand_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[int DEFAULT NULL COMMENT '']]>
        /// </remarks>
        [Column]
        public int? BrandId { get; set; }

        /// <summary>
        /// 小图
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(128) DEFAULT NULL COMMENT '小图']]>
        /// </remarks>
        [Column(128)]
        [DisplayName("小图")]
        public string SmallImg { get; set; }

        /// <summary>
        /// 轮播图 *jarray*
        /// </summary>
        /// <remarks>
        /// <![CDATA[json DEFAULT NULL COMMENT '轮播图 *jarray*']]>
        /// </remarks>
        [Column]
        [DisplayName("轮播图")]
        public JArray BannerImgs { get; set; }

        /// <summary>
        /// 详情图 *jarray*
        /// </summary>
        /// <remarks>
        /// <![CDATA[json DEFAULT NULL COMMENT '详情图 *jarray*']]>
        /// </remarks>
        [Column]
        [DisplayName("详情图")]
        public JArray DetailImgs { get; set; }

        /// <summary>
        /// 关键词
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(512) DEFAULT NULL COMMENT '关键词']]>
        /// </remarks>
        [Column(512)]
        [DisplayName("关键词")]
        public string Keywords { get; set; }

        /// <summary>
        /// 视频封面图
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(128) DEFAULT NULL COMMENT '视频封面图']]>
        /// </remarks>
        [Column(128)]
        [DisplayName("视频封面图")]
        public string VideoCoverImg { get; set; }

        /// <summary>
        /// 视频地址
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(128) DEFAULT NULL COMMENT '视频地址']]>
        /// </remarks>
        [Column(128)]
        [DisplayName("视频地址")]
        public string VideoSrc { get; set; }

        [JsonConverter(typeof(AutoEnumConverter))]
        public SaleChannelEnum SaleChannelName => (SaleChannelEnum)SaleChannel;

        /// <summary>
        /// 销售渠道 【#flags物流快递=1,门店领取=2】
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '销售渠道 【#flags物流快递=1,门店领取=2】']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("销售渠道")]
        public int SaleChannel { get; set; }

        /// <summary>
        /// 结算价格
        /// </summary>
        /// <remarks>
        /// <![CDATA[decimal(10,2) NOT NULL COMMENT '结算价格']]>
        /// </remarks>
        [Column(10, false, Digit = 2)]
        [DisplayName("结算价格")]
        public decimal SupplyPrice { get; set; }

        /// <summary>
        /// 建议零售价
        /// </summary>
        /// <remarks>
        /// <![CDATA[decimal(10,2) DEFAULT NULL COMMENT '建议零售价']]>
        /// </remarks>
        [Column(10, Digit = 2)]
        [DisplayName("建议零售价")]
        public decimal? MsrPrice { get; set; }

        /// <summary>
        /// 单规格
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '单规格']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("单规格")]
        public bool IsSingleSku { get; set; }

        /// <summary>
        /// 在售
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '在售']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("在售")]
        public bool IsOnSale { get; set; }

        /// <summary>
        /// 检查库存
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '检查库存']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("检查库存")]
        public bool IsCheckStock { get; set; }

        /// <summary>
        /// 是否审核
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '是否审核']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("是否审核")]
        public bool IsApproved { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '是否删除']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("是否删除")]
        public bool IsDel { get; set; }

        /// <summary>
        /// 禁用售后
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '禁用售后']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("禁用售后")]
        public bool DisableSaleAfter { get; set; }

        /// <summary>
        /// 销售量
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '销售量']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("销售量")]
        public int SaleTimes { get; set; }

        /// <summary>
        /// 浏览量
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '浏览量']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("浏览量")]
        public int ReadTimes { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '排序']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("排序")]
        public int Sort { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        /// <remarks>
        /// <![CDATA[datetime NOT NULL COMMENT '更新时间']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("更新时间")]
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        /// <remarks>
        /// <![CDATA[datetime NOT NULL COMMENT '创建时间']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("创建时间")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 创建日期
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '创建日期']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("创建日期")]
        public int CreateDate { get; set; }

    }
}
